package com.lyloou.practice.config;

import com.lyloou.practice.App;
import com.lyloou.practice.factory.AnnotationBeanFactory;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class MyAppServletContextListener implements ServletContextListener {
    static {
        try {
            AnnotationBeanFactory.init(App.class.getPackage().getName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void contextDestroyed(ServletContextEvent arg0) {
        System.out.println("ServletContextListener destroyed");
    }

    @Override
    public void contextInitialized(ServletContextEvent arg0) {
        System.out.println("ServletContextListener started");
    }
}